define users::resources::user (
  $ensure     = 'present',
  $comment    = 'managed by puppet',
  $expiry     = 'absent',
  $uid        = undef,
  $gid        = undef,
  $groups     = undef,
  $home       = undef,
  $managehome = true,
  $password   = undef,
  $shell      = '/bin/bash',
  $system     = false,
) {
  
  user { $title:
    ensure     => $ensure,
    comment    => $comment,
    expiry     => $expiry,
    uid        => $uid,
    gid        => $gid,
    groups     => $groups,
    home       => $home,
    managehome => $managehome,
    password   => pw_hash($password,'SHA-512',fqdn_rand_string(10)),
    shell      => $shell,
    system     => $system,
  }
}